import request from "@/utils/request";

// 公告列表
const NoticeList = (params) => {
    return request({
        url: "/notices",
        params: {
            ...params
        }
    });
};

// 添加公告
const AddNotice = (data) => {
    return request({
        url: "/notices",
        method: "post",
        data
    });
};

// 删除公告
const DeleteNotice = (id) => {
    return request({
        url: `/notices/${id}`,
        method: "delete"
    });
};

// 修改公告
const UpdateNotice = (id, data) => {
    return request({
        url: `/notices/${id}`,
        method: "patch",
        data
    });
};

// 获取公告详情
const NoticeDetail = (id) => {
    return request({
        url: `/notices/${id}`
    });
};

export { NoticeList, AddNotice, DeleteNotice, UpdateNotice, NoticeDetail };
